<?php
class mapModel{
	private $db;
	private $ecs;
	public function __construct(){
		$this->db = $GLOBALS['db'];
		$this->ecs = $GLOBALS['ecs'];
	}
	public function get_appid_ser(){
		$sql ="SELECT * FROM `wxch_config` WHERE `id` = 1";
		$res=$this->db->getRow($sql);
		return $res;
	}
	
	public function get_map_list($cfg=array()){
		$where = " 1=1 ";
		$sql="SELECT * FROM ".$this->ecs->table("store")." WHERE 1=1 AND $where ";
		$result = $this->db->getAll($sql);
		return $result;
	}
	
	public function get_map_list_page($cfg = array("page"=>1)){
		$page = $cfg['page'];
		$where = " 1=1 ";
		$pageSize = constant("PAGE_SIZE");
		$pageNum = ($page-1)*$pageSize;
		$sql="SELECT * FROM ".$this->ecs->table("store")." WHERE $where  LIMIT ".$pageNum.",".$pageSize;
		$res = $this->db->getAll($sql);
		return $res;
	}
}